<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/21
 * Time: 0:56
 */
include "../classes/logincheck.php";
include '../classes/conn.php';
if(islogin()!='teacher_login'){
    die('error');
}

$title=$_POST['title'];
$class=$_POST['class'];
$detail=$_POST['detail'];
$time=date('Y-m-d H:i:s');

$query="insert into notice(title, detail, class, time) values ('{$title}','{$detail}','{$class}','{$time}')";

if($class='all'){
    $query="insert into notice(title, detail, time) values ('{$title}','{$detail}','{$time}')";
}

$res=mysql_query($query);
if($res){
    echo '1';
}
else echo '0';
